#ifndef _SMARTBUFFER_H_
#define _SMARTBUFFER_H_

#include <memory>
#include <cstring>

namespace smartBuffer
{

class SmartBuffer
{
public:
    SmartBuffer();
    SmartBuffer(size_t size);
    SmartBuffer(const SmartBuffer & src);
    SmartBuffer(SmartBuffer && src);
    ~SmartBuffer();

    SmartBuffer & operator=(const SmartBuffer & src);
    SmartBuffer & operator=(SmartBuffer && src);
    void add(char * src, size_t size);
    char * getPtr();
    size_t size();


private:
    char *                          m_buf;
    size_t                          m_size      = 0;
    size_t                          m_cap       = 1024; 
    bool                            m_isUse     = true;


};

}



#endif
